<?php
include(_DOC_ROOT.'classes/Content/Content.php');
include(_DOC_ROOT.'classes/Customer/Customer.php');
include_once(_DOC_ROOT.'lib/mail/class.phpmailer.php');
$module = ($module)?$module:'home';
if(isset($module)) {
	$pobj = new Content();
	$page = $pobj->getContent($module);
	$page['images'] = getEntityImages($module);
	$_META_TITLE = $page['meta_title'];
	$_META_KEYWORD = $page['meta_keyword'];
	$_META_DESCRIPTION = $page['meta_description'];
	
}

array_push($jsFiles,  '');
array_push($cssFiles, '');
$brd_url['Contact Us'] = _SITE_URL.'contact-us';

if(isset($_POST['customer_contact'])) {
	$status = 'block';
	if(trim($_POST['name']) == '')
		$err_arr[] = "Plese enter your name.";
	if(trim($_POST['email']) == '')
		$err_arr[] = "Plese enter valid email Id.";
	if(trim($_POST['query']) == '')
		$err_arr[] = "Plese enter your query.";
	if(count($err_arr)) {
		$errmsg = 'Please Enter all required data.';
	}
	else {
		$arr['name'] = trim($_POST['name']);
		$arr['phone'] = trim($_POST['phone']);
		$arr['email'] = trim($_POST['email']);
		$arr['query'] = trim($_POST['query']);
		$cobj = new Customer();
		if($cobj->customer_contact($arr)) {
			
				$mail = new PHPMailer();
				$mail->From       = $AdminEmail;
				$mail->FromName   = $_POST['email'];
				$mail->AddAddress($AdminEmail, "DailShaadi");
				$mail->Subject    = "Costomer Query.";
				$body = file_get_contents('template/email/contact.tpl');
				$body = eregi_replace("[\]",'',$body);
				$find = array('#NAME#','#EMAIL#','#PHONE#','#QUERY#');
				$replace = array($arr['name'],$arr['email'],$arr['phone'],$arr['query']);
				$body = str_replace($find,$replace,$body);
				$mail->MsgHTML($body);
				if(!$mail->Send()) 
				{
					//die("Mailer Error: " . $mail->ErrorInfo);
				}
				$errmsg = 'Thank you for contacting us.';
				$post=false;
		}
	}
}
$_tplName = 'contact-us.tpl';

$footer_links_tpl = 'footer_main_links.tpl';
include(_SITE_TPL_PATH_.'site_main.tpl');
?>